/*
 * AmpelController.h
 *
 *  Created on: 14.05.2011
 *      Author: Tim
 */

#ifndef AMPELCONTROLLER_H_
#define AMPELCONTROLLER_H_

//Bibliotheken
#include <pthread.h>
#include <stdio.h>
#include <sys/neutrino.h>
#include <hw/inout.h>
#include <cstdlib>
#include <iostream>
#include <unistd.h>
#include <errno.h>

#include "HAWThread.h"
#include "OutBefehle.h"
#include "HAL.h"
#include "Timer.h"

enum AmpelStates {
 GRUEN,
 GELB,
 ROT,
 ROT_BLINK,
 AUS,
 GRUENGELB,
 ROT_BLINK_SCHNELL,
 ROT_BLINK_LANGSAM,
 ROT_BLINK_AUS,
 TIMERPARTY
};

class AmpelController : public thread::HAWThread{
public:
	static AmpelController* getInstance();

	void ampel_aufruf(AmpelStates);

private:
	AmpelController();//private, weil singleton
	virtual ~AmpelController();
	AmpelController(const AmpelController&) {}

	void ampel_gruen(void);
	void ampel_gelb(void);
	void ampel_rot(void);
	void ampel_rotBlink(void);
	void ampel_aus(void);
	void ampel_gruen_gelb(void);
	void ampel_start_schnell(void);
	void ampel_start_langsam(void);
	void timer_stopper(void);
	void timer_partey(void);

	void execute(void*);
    void shutdown();

    bool blinkAn;

	AmpelStates ampel_state;
	AmpelStates ampel_state_x;
    HAL * hal;
    Timer * timerSF;
	static AmpelController* aInstance;
};

#endif /* AMPELCONTROLLER_H_ */
